import { getLevelFirstJson, getLevelZeroJson } from '@/utils';
import { DelegateManageAPI } from '../common/type';

/** 流程设计搜索 */
const getSearchColumns = (
  loadMdicMap: Record<string, any>,
  switchObj: Record<string, any>,
): DelegateManageAPI.IHeaderSearchType => {
  let orgDeptList: any[] = [];
  if (switchObj?.queryType == 0) {
    orgDeptList = getLevelZeroJson();
  } else if (switchObj?.queryType == 1) {
    orgDeptList = getLevelFirstJson();
  } else {
    orgDeptList = getLevelZeroJson();
  }

  return [
    {
      name: 'state',
      placeholder: '状态',
      label: '状态',
      componentType: 'Select',
      dataSource: [
        {
          name: '禁用',
          value: '0',
        },
        {
          name: '启用',
          value: '1',
        },
      ],
      allowClear: true,
      md: 6,
      sm: 24,
      whetherSenior: false,
    },
    {
      name: 'wtyuanyin',
      label: '委托原因',
      placeholder: '委托原因',
      componentType: 'Input',
      allowClear: true,
      md: 6,
      sm: 24,
      whetherSenior: false,
    },
    {
      name: 'signTime',
      placeholder: '委托',
      label: '委托时间',
      componentType: 'RangePicker',
      allowClear: true,
      md: 12,
      sm: 24,
      whetherSenior: false,
    },
    {
      name: 'weituoFormName',
      placeholder: '委托',
      label: '委托',
      componentType: 'DeptAndUser',
      dataSource: orgDeptList,
      allowClear: true,
      md: 6,
      sm: 24,
      whetherSenior: true,
      formOrgType: {
        COMP: 'weituoCompanyID',
        DEPT: 'weituoDepartmentID',
        POS: 'weituoPositionID',
        USER: 'weituoID',
      }, //获取组织机构表单name, componentType: 'DeptAndUser', 必传
    },
    {
      name: 'bweituoFormName',
      placeholder: '被委托',
      label: '被委托',
      componentType: 'DeptAndUser',
      dataSource: orgDeptList,
      allowClear: true,
      md: 6,
      sm: 24,
      whetherSenior: true,
      formOrgType: {
        COMP: 'bweituoCompanyID',
        DEPT: 'bweituoDepartmentID',
        POS: 'bweituoPositionID',
        USER: 'bweituoID',
      }, //获取组织机构表单name, componentType: 'DeptAndUser', 必传
    },
  ];
};

export { getSearchColumns };
